namespace Nice157Advices.Advices
{
    /// <summary>
    /// 9、习惯重载运算符
    /// </summary>
    public static class _9
    {
        /**
         * 习惯运算符重载
         */

        public static void Go ()
        {
            var s1 = new Salary { RMB = 100 };
            var s2 = new Salary { RMB = 200 };

            var s3 = s1 + s2;
            System.Console.WriteLine ($"{s3.RMB}");
        }

        private class Salary
        {
            public int RMB { get; set; }

            public static Salary operator + (Salary s1, Salary s2)
            {
                s2.RMB += s1.RMB;
                return s2;
            }
        }
    }
}